{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 步行路径规划函数\n",
    "def walking(origin,destination,sig=None)->dict:\n",
    "    url = 'https://restapi.amap.com/v3/direction/walking?parameters'\n",
    "    params={\n",
    "        'key':key,\n",
    "        'origin':origin,\n",
    "        'destination':destination,\n",
    "        'output':'json'\n",
    "    }\n",
    "    response = requests.get(url,params=params)\n",
    "    data = response.json()\n",
    "    return data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>status</th>\n",
       "      <th>info</th>\n",
       "      <th>infocode</th>\n",
       "      <th>count</th>\n",
       "      <th>route</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>destination</th>\n",
       "      <td>1</td>\n",
       "      <td>ok</td>\n",
       "      <td>10000</td>\n",
       "      <td>1</td>\n",
       "      <td>113.586605,23.548852</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>origin</th>\n",
       "      <td>1</td>\n",
       "      <td>ok</td>\n",
       "      <td>10000</td>\n",
       "      <td>1</td>\n",
       "      <td>113.679287,23.632575</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>paths</th>\n",
       "      <td>1</td>\n",
       "      <td>ok</td>\n",
       "      <td>10000</td>\n",
       "      <td>1</td>\n",
       "      <td>[{'distance': '16748', 'duration': '13398', 's...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            status info infocode count  \\\n",
       "destination      1   ok    10000     1   \n",
       "origin           1   ok    10000     1   \n",
       "paths            1   ok    10000     1   \n",
       "\n",
       "                                                         route  \n",
       "destination                               113.586605,23.548852  \n",
       "origin                                    113.679287,23.632575  \n",
       "paths        [{'distance': '16748', 'duration': '13398', 's...  "
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "从化地铁站 = geocode('广东省广州市从化区从化地铁站')\n",
    "从化地铁站_geocode = 从化地铁站['geocodes'][0]['location']\n",
    "zdnf_geocode = zdnf['geocodes'][0]['location']\n",
    "中大南方_从化地铁站 = walking(zdnf_geocode,从化地铁站_geocode)\n",
    "route = pd.DataFrame(中大南方_从化地铁站)\n",
    "route"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
